#pragma once
#include "DXAMLCommon.h"
#include "CCommonPlatformServices.h"

#include "XamlType.h"
#include "IXcpHostSite.h"
#include "IXcpDispatcher.h"
#include "IXcpBrowserHost.h"
#include "IPALApplicationDataProvider.h"
#include "IPALClock.h"
#include "ICoreServices.h"
#include "IPALAcceleratedGraphicsFactory.h"
#include "IPALPrintTarget.h"
#include "IPALD2DPrintingData.h"
#include "IPALFile.h"
#include "PALText.IFontAndScriptServicesFactory.h"
#include "IPALImageFactory.h"
#include "IPALPrintingData.h"
#include "IPALRegion.h"
#include "IPALResourceProvider.h"
#include "IPALSurfaceUpdatePoolMap.h"
#include "IPALWorkItemFactory.h"
#include "IPALCriticalSection.h"
#include "IPALOfflineApplicationStore.h"
#include "IPALEvent.h"
#include "ICallingMethod.h"
#include "IPALDownloadResponse.h"
#include "IPALDirectManipulationService.h"
#include "IPALHttpProxy.h"
#include "IPALApplicationSingleton.h"
#include "IXcpInputPaneHandler.h"
#include "IPALInputPaneInteraction.h"
#include "IPALSettingsDictionaryNode.h"
#include "MonitorBuffer.h"
#include "IPlatformUtilities.h"
#include "IPALOfferableHeap.h"
#include "CWinSettingsServices.h"
#include "XFixedSizeAllocator.h"
#include "IXcpTouchInteractionElement.h"
#include "IPALTouchInteraction.h"
#include "IXcpTraceMessageSink.h"
#include "ITracingService.h"
#include "IPALMediaLayerTrace.h"
#include "IPALReader.h"
#include "IPALMalloc.h"
#include "IPALMutex.h"
#include "IPALQueue.h"
#include "IPALSemaphore.h"
#include "IPALWaitable.h"
#include "IXcpRenderCounters.h"
#include "WinSystemSettings.h"
#include "CWinWebcamServices.h"
#include "CWinRegkeyServices.h"


class CWindowsServices :
	public CCommonPlatformServices
{
public:
	CWindowsServices(void);
	~CWindowsServices(void);

	//static void *operator new(size_t size) throw(std::bad_alloc);

	//static void operator delete(void *p) throw();

#pragma region IPALDebuggingServices
	virtual void * XcpDebugAllocate( XUINT32 cSize, DebugAllocationClass allocationClass );

	virtual void * XcpDebugResize( void *pAddress, XUINT32 cSize, DebugAllocationClass allocationClass );

	virtual void XcpDebugFree( void *pAddress, DebugAllocationClass allocationClass );

	virtual HRESULT XcpCheckLeaks( XINT32 fSilent );

	virtual void XcpTrackAddRefRelease( void *pAddress, XUINT32 cRef );

	virtual void XcpDebugSetLeakDetectionFlag( void *pAddress, XINT32 fDisableLeakDetection );

	virtual XUINT32 XcpVTrace( XUINT32 uClass, const XCHAR * pFilename, XINT32 iLine, XINT32 iValue, const XCHAR * pTestString, const XCHAR * pMessageString, void *pVArgs );

	virtual XUINT32 XcpTrace( XUINT32 uClass, const XCHAR * pFilename, XINT32 iLine, XINT32 iValue, const XCHAR * pTestString, const XCHAR * pMessageString,... );

	virtual void YieldSlice();

	virtual HRESULT GetMonitorBuffer( MonitorBuffer **ppMonitorBuffer );

	virtual IThreadMonitor * GetThreadMonitor();

	virtual HRESULT ReleaseMonitorBuffer( MonitorBuffer *pMonitorBuffer );

	virtual void InitializeThreadMonitoring();

	virtual void DeleteThreadMonitoring();

	virtual XINT32 StringCchVPrintf( XCHAR * pString, XUINT32 cString, const XCHAR * pFormat, char * pVArgs );

	virtual XINT32 StringCchVPrintfA( char * pString, XUINT32 cString, const char * pFormat, char * pVArgs );

	virtual XINT32 YesNoMessageBox( XCHAR * pContent, const XCHAR * pTitle );

	virtual void XcpEnterSection( XUINT16 id );

	virtual void XcpLeaveSection( XUINT16 id );

	virtual void XcpPopToMark();

	virtual HRESULT XcpTraceMonitorInitialize( XBYTE testMode );

	virtual void XcpTraceMonitorShutdown();

	virtual XINT32 XcpTraceMonitorAttached();

	virtual HRESULT CaptureStack( XUINT32 cMaxCallers, XUINT32 *pcCallers, XUINT64 **ppCallers, XUINT32 cIgnoreLevels );

	virtual HRESULT GetCallerSourceLocations( XUINT32 cCallers, XUINT64 *pCallers, ICallingMethod **ppCallingMethods );

	virtual void FreeCallingMethods( ICallingMethod *pCallers );

	virtual void BlockMemoryTrace( XINT32 bDisable );

	virtual void SetTraceMessageSink( IXcpTraceMessageSink *pTraceSink );

	virtual HRESULT GetTraceMessageSink( IXcpTraceMessageSink **ppTraceSink );

	virtual HRESULT XcpPerfMarker( XUINT64 lMarker );

	virtual HRESULT XcpPerfMarkerStringInfo( XUINT64 lMarker, XCHAR * szMarkerInfo );

	virtual HRESULT XcpPerfMarkerDwordInfo( XUINT64 lMarker, XCHAR * nMarkerInfo );

	virtual _PerfMarkerType PerfMarkersEnabled();

	virtual HRESULT XcpRenderCountersInitialize();

	virtual HRESULT XcpRenderCountersIncrement( XUINT32 uCounter );

	virtual HRESULT DebugOutputSzNoEndl( const XCHAR * pFormattedMsg,... );

	virtual void DebugOutputSz( const XCHAR * pMessage );

	virtual XUINT32 DebugAssertMessageBox( const XCHAR * pCondition, const XCHAR * pFile, XUINT32 nLine );

	virtual void DebugBreak();

	virtual unsigned char TESTSignalMemLeak();

	virtual void TESTSignalManagedMemLeak( XUINT32 *showAssert );

	virtual void TESTSignalASSERT( const XCHAR * pString );

	virtual void TESTSignalReferenceTrackerLeak();

	virtual void FreeStackTrace( void *pCallers );

	virtual HRESULT IsDebuggerAttached( XBOOL *pfDebuggerAtached );

	virtual void SetTraceFlags( XUINT32 *pFlags );

	virtual XUINT32 GetTraceFlags();

	virtual HRESULT GetTracingService( XTraceLevel level, XUINT32 suite, ITracingService **ppInterface );

	virtual HRESULT GetTracingService( ITracingService **ppInterface );

	virtual XUINT32 IsTracingServiceEnabled( XTraceLevel level, XUINT32 suite );

	virtual HRESULT MediaTraceCreate( IPALReader *pReader, IPALMediaLayerTrace **ppTrace );

	virtual HRESULT GetDescriptionForMediaLog( XUINT32 *pBufferLength, XCHAR * pszBuffer );

	virtual XUINT64 GetMemoryCount();

	virtual void GetTrackerStressFromEnvironment( XUINT32 *pMaxIterations, XUINT32 *pStartIteration );

	virtual void EnableVisualTreeWalk( XUINT32 fEnable );

	virtual XUINT32 ShouldWalkVisualTree();

	virtual void EnableDirtyFlagsTreeWalk( XUINT32 fEnable );

	virtual XUINT32 ShouldWalkDirtyFlagsTree();

	virtual void EnableDumpSurface( XUINT32 fEnable );

	virtual XUINT32 ShouldDumpSurface();

	virtual void DumpSurface( IPALSurface * pSurface );

	virtual void EnableFullscreenPin( XUINT32 fEnable );

	virtual XUINT32 ShouldPinFullscreen();

	virtual XUINT32 WaitForManagedDebugger();

	virtual HRESULT ShowErrorDialog( const XCHAR * pszTitle, const XCHAR * pszError );

#pragma endregion

#pragma region IPALMemoryServices
	virtual void * OSMemoryAllocate( XUINT32 cSize );

	virtual void * OSMemoryResize( void *pAddress, XUINT32 cSize );

	virtual void OSMemoryFree( void *pAddress );

	virtual XUINT32 GetCurrentThreadId();

	virtual XINT32 MemoryCreate( IPALMalloc **ppMalloc );

	virtual HRESULT AllocatePages( XUINT32 cBytes, void **ppPages, XUINT32 flags );

	virtual HRESULT ReleasePages( XUINT32 cBytes, void *pPages );

	virtual HRESULT MarkPages( XUINT32 cBytes, void *pPages, XUINT32 flags );

	virtual HRESULT CreatePALMemoryFromBuffer( XUINT32 cbBuffer, XBYTE *pBuffer, IPALMemory **ppPALMemory );

	virtual HRESULT GetProcessOfferableHeap( IPALOfferableHeap **ppHeap );

	virtual HRESULT RegisterMemoryPressureCallbacks( XINT32 (__stdcall *pfnAddMemoryPressure ) (XUINT64), XINT32 (__stdcall *pfnRemoveMemoryPressure)(XUINT64));

	virtual void UpdateAllocatedMemory( XINT64 cSize );

	virtual void ReportMemoryPressureToGC();

	virtual void SetMemoryPressureReportingPolicy( XUINT32 );

	virtual HRESULT GetSharedPointerControlBlockAllocator( XFixedSizeAllocator **ppAllocator );

	virtual HRESULT ReleaseSharedPointerControlBlockAllocator( XUINT32 *outLeakedItems );

	virtual void Delete( void * );

	virtual void DeleteArray( void * );
#pragma endregion

#pragma region IPALURIServices
	virtual HRESULT UriCreate( XINT32 bCanonicalize, XUINT32 codepage, XUINT32 cString, char *pString, IPALUri **ppUri );

	virtual HRESULT UriCreate( XUINT32 cString, XCHAR * pString, IPALUri **ppUri );

	virtual HRESULT InterchangeUriAndPath( XCHAR * pSource, XUINT32 cSource, XCHAR * pTarget, XUINT32 *pcTarget, XUINT32 fToPath );
#pragma endregion 

#pragma region IPALMathServices
	virtual XINT64 MathFloor( long double rNum );

	virtual XINT32 MathFloorF( XFLOAT rNum );

	virtual XINT64 MathCeiling( long double rNum );

	virtual XINT32 MathCeilingF( XFLOAT rNum );

	virtual XINT32 MathIsFiniteF( XFLOAT rNum );

	virtual XINT32 MathIsNanF( XFLOAT rNum );

	virtual XDOUBLE MathSqrt( long double rNum );

	virtual XFLOAT MathSqrtF( XFLOAT rNum );

	virtual XDOUBLE MathLogarithm( long double eValue );

	virtual XDOUBLE MathExponent( long double ePower );

	virtual XFLOAT MathPower( XFLOAT eBase, XFLOAT ePower );

	virtual XFLOAT MathCos( XFLOAT eRadians );

	virtual XFLOAT MathSin( XFLOAT eRadians );

	virtual XFLOAT MathArcTan2( XFLOAT y, XFLOAT x );

	virtual XFLOAT MathCosDegrees( XFLOAT eDegrees );

	virtual XFLOAT MathSinDegrees( XFLOAT eDegrees );

	virtual XFLOAT MathTanDegrees( XFLOAT eDegrees );

	virtual XFLOAT MathLogarithm10( XFLOAT eValue );

	virtual XFLOAT MathArcTan( XFLOAT eRadians );

	virtual XINT32 MathRand();

	virtual HRESULT CreateRegion( IPALRegion **ppRegion );
#pragma endregion

#pragma region IPALStringServices
	virtual HRESULT ConvertString( XUINT32 cString, XCHAR * pString, long double *peValue, XCHAR * *ppString );

	virtual HRESULT ConvertDouble( long double eValue, XUINT32 cString, XCHAR * *ppString );
#pragma endregion

#pragma region IPALPrintIOServices
	virtual HRESULT PrintStringCchA( char *pszDest, XUINT32 cchDest, const char *pszFormat,... );

	virtual HRESULT PrintStringCchVA( char *pszDest, XUINT32 cchDest, const char *pszFormat,va_list vargs );

	virtual HRESULT PrintStringCchExA( char *pszDest, XUINT32 cchDest, char **ppszDestEnd, XUINT32 *pcchRemaining, XUINT32 dwFlags, const char *pszFormat,... );

	virtual HRESULT PrintStringCchExVA( char *pszDest, XUINT32 cchDest, char **ppszDestEnd, XUINT32 *pcchRemaining, XUINT32 dwFlags, const char *pszFormat, va_list vargs );

	virtual HRESULT PrintStringCchW( XCHAR * pszDest, XUINT32 cchDest, const XCHAR * pszFormat,... );

	virtual HRESULT PrintStringCchVW( XCHAR * pszDest, XUINT32 cchDest, const XCHAR * pszFormat,va_list vargs );

	virtual HRESULT PrintStringCchExW( XCHAR * pszDest, XUINT32 cchDest, XCHAR * *ppszDestEnd, XUINT32 *pcchRemaining, XUINT32 dwFlags, const XCHAR * pszFormat,... );

	virtual HRESULT PrintStringCchExVW( XCHAR * pszDest, XUINT32 cchDest, XCHAR * *ppszDestEnd, XUINT32 *pcchRemaining, XUINT32 dwFlags, const XCHAR * pszFormat, va_list vargs );
#pragma endregion

#pragma region IPALThreadingServices
	virtual XINT32 InterlockedCompareExchange( XINT32 *pTarget, XINT32 Exchange, XINT32 Comperand );

	virtual void * PALInterlockedCompareExchangePointer( void **ppTarget, void *pExchange, void *pComperand );

	virtual void * PALInterlockedExchangePointer( void **ppTarget, void *pExchange );

	virtual XINT32 InterlockedDecrement( XINT32 *pnTarget );

	virtual XINT32 InterlockedExchange( XINT32 *pnTarget, XINT32 nValue );

	virtual XINT32 InterlockedExchangeAdd( XINT32 *pnTarget, XINT32 nValue );

	virtual XINT32 InterlockedIncrement( XINT32 *pnTarget );

	virtual HRESULT CriticalSectionCreate( IPALCriticalSection **ppCritical );

	virtual HRESULT ThreadCreate( IPALWaitable **ppThread, XINT32 (__stdcall *pfn ) (char *), XUINT32 cData, char *pData);

	virtual HRESULT EventCreate( IPALEvent **ppEvent, XINT32 bSignaled, XINT32 bManual );

	virtual HRESULT SemaphoreCreate( IPALSemaphore **ppSemaphore, XUINT32 cMaxCount, XUINT32 cInitialCount );

	virtual HRESULT QueueCreate( IPALQueue **ppQueue, XUINT32 cMaxLength );

	virtual HRESULT SharedMemoryCreate( IPALMemory **ppSharedMemory, PAL_IPCInitMode initMode, XUINT32 bLowIntegrity, XUINT32 ulSize, CXString *pstrName );

	virtual HRESULT SharedMemoryDestroy( CXString * pstrName );

	virtual HRESULT NamedMutexCreate( IPALMutex **ppNamedMutex, PAL_IPCInitMode initMode, XUINT32 bLowIntegrity, XUINT32 bInitialOwner, CXString *pstrName );

	virtual HRESULT NamedMutexDestroy( CXString * pstrName );

	virtual HRESULT NamedEventCreate( IPALEvent **ppEvent, PAL_IPCInitMode initMode, XUINT32 bLowIntegrity, XUINT32 bInitialState, CXString *pstrName );

	virtual HRESULT NamedEventDestroy( CXString * pstrName );

	virtual XUINT32 WaitForObjects( XUINT32 cWaitable, IPALWaitable **ppWaitable, XINT32 bAll, XUINT32 nTimeout );

	virtual HRESULT PALSleep( XUINT32 dwMilliseconds );

	virtual XINT32 ThreadGetPriority( IPALWaitable *pThread );

	virtual HRESULT ThreadSetPriority( IPALWaitable *pThread, XINT32 nPriority );

	virtual XINT32 ProcessGetPriority();

	virtual HRESULT ProcessSetPriority( XINT32 nPriority );
#pragma endregion

#pragma region IPALUIServices
	virtual HRESULT GetOpenFileName( void *, XINT32 * );

	virtual HRESULT GetSaveFileName( void *, XINT32 * );

	virtual XUINT32 PALGetCaretBlinkTime();

	virtual XUINT32 PALGetDoubleClickTime();

	virtual XUINT32 PALGetDoubleClickDeltaX();

	virtual XUINT32 PALGetDoubleClickDeltaY();

	virtual HRESULT ClipboardContainsText( XUINT32 *pContainsText );

	virtual HRESULT GetClipboardText( CXString **ppstrText, CXString **ppstrXaml );

	virtual HRESULT SetClipboardText( CXString *pstrText, CXString *pstrXaml );

	virtual EndOfLineType::Enum GetEndOfLineType();
#pragma endregion


#pragma region IPALTextServices
	virtual XEDITKEY TranslateEditKey( InputMessage *pMsg );

	virtual void PALSetIsInputMethodEditorEnabled( void *hWnd, XUINT32 fEnableIME );

	virtual void PALSetImeConversionMode( void *hWnd, XUINT32 conversionMode );

	virtual void PALSetImeState( void *hWnd, XUINT32 imeState );

	virtual void PALSetTextCompositionWindow( void *hWnd, XPOINTF point );

	virtual void PALCompleteTextComposition( void *hWnd );

	virtual HRESULT PALGetTextCompositionString( void *hWnd, XUINT32 fResultString, CXString **ppstrText );

	virtual HRESULT PALGetTextCompositionStringAttribute( void *hWnd, XINT32 **ppClauseInfo, XUINT32 *pClauseInfoCount, char **ppAttributes, XUINT32 *pAttributeCount );

	virtual HRESULT PALGetTextCompositionPosition( void *hWnd, XUINT32 *pCaretPosition, XUINT32 *pDeltaPosition );

	virtual void PALSetInputMethodCandidateWindow( void *hWnd, XRECTF_WH rect, XPOINTF point );

	virtual void PALInputMethodConvertToHanja( void *hWnd, WCHAR charCode );

	virtual XUINT32 PALIsReadingWindowIME();

	virtual HRESULT PALGetLayoutLanguage( XUINT32 *pLangID );

	virtual HRESULT CreateFontAndScriptServices( PALText::IFontAndScriptServicesFactory **ppFontAndScriptServices );
#pragma endregion

#pragma region IPALCoreServices
	virtual HRESULT FileCreate( XUINT32 cFileName, XCHAR * pFileName, XINT32 fileOptions, IPALFile **ppFile );

	virtual HRESULT GetPlatformUtilities( IPlatformUtilities **ppInterface );

	virtual HRESULT CreatePowerAvailablityRequest( void ** );

	virtual HRESULT DisablePowerManagement( void * );

	virtual HRESULT EnablePowerManagement( void * );

	virtual HRESULT FreePowerAvailablityRequest( void * );

	virtual XUINT64 GetCPUTime();

	virtual XUINT64 GetCPUMilliseconds();

	virtual HRESULT GetOSTime( XSYSTEMTIME *pTime );

	virtual HRESULT CreateClock( IPALClock **ppIClock );

	virtual HRESULT GetNumberOfCPUCores( XUINT32 *pcProcessorCores );

	virtual XUINT32 IsSupportedPlatform();

	virtual HRESULT GetRandomBytes( XUINT32 cbRandom, char *pRandom );

	virtual HRESULT GetApplicationSingleton( IPALApplicationSingleton **ppSingleton );

	virtual XUINT32 GenerateSecurityToken();

	virtual HRESULT GetKeyboardModifiersState( XUINT32 *pModifiers );

	virtual XUINT32 PerformanceFrequency( XINT64_LARGE_INTEGER *lpFrequency );

	virtual XUINT32 PerformanceCounter( XINT64_LARGE_INTEGER *lpPerformanceCount );

	virtual HRESULT CallCoInitializeMTA();

	virtual void CallCoUninitialize();

	virtual HRESULT GetClientInformation( XINT32 *pcItems, XCHAR * *ppItems );

	virtual HRESULT IsOnRemoteDesktopSession( XUINT32 *pfOnRemoteDesktop );
#pragma endregion

#pragma region IPALTouchInteractionServices
	virtual HRESULT IsDirectManipulationSupported( XUINT32 *isDirectManipulationSupported );

	virtual XUINT32 IsPointerInfoValid( XUINT32 pointerId );

	virtual HRESULT GetTouchInteraction( IXcpTouchInteractionElement *pElement, XUINT32 bTabEnabled, XUINT32 bDoubleTabEnabled, XUINT32 bRightTabEnabled, XUINT32 bHoldEnabled, XUINT32 uiManipulationMode, IPALTouchInteraction **ppTouchInteraction );

	virtual HRESULT GetDirectManipulationService( IPALDirectManipulationService **ppDirectManipulationService );

	virtual HRESULT GetInputPaneInteraction( void *hWindow, IXcpInputPaneHandler *pInputPaneHandler, IPALInputPaneInteraction **ppInputPaneInteraction );
#pragma endregion

#pragma region IPALCLRServices
	virtual HRESULT CreateCLRRuntimeHost( void *pRawAppDomain, ICoreServices *pCore );

	virtual HRESULT CreateCLRRuntimeHost( ICLRRuntimeHost2 ** ppCLR, XCHAR * * ppszTrustedPath , XCHAR * * ppszPlatformAssembliesList, XCHAR * * ppszManifestBase, XCHAR * * ppszManifestFilePath );
#pragma endregion

#pragma region IPALOfflineApplicationServices
	virtual HRESULT CreateOfflineApplicationStore( CXString *, XUINT32, IPALOfflineApplicationStore ** );

	virtual HRESULT RegisterOfflineApplication( const void *hwndOwner, const XCHAR * pszSite, const long double nUsedInMB, const long double nRequestedInMB );

	virtual HRESULT UnregisterOfflineApplication( CXString * );

	virtual HRESULT LaunchOfflineApplication( CXString * );

	virtual HRESULT RequestApplicationInstall( IXcpBrowserHost *, const void *, XUINT32, AuthenticodeSignatureResult, AuthenticodeTrustResult, IPALCertificate *, const XCHAR * , const XCHAR * , IPALMemory *, XINT32 * );

	virtual HRESULT GetApplicationID( IPALUri *pXapUri, XUINT32 bRegister, CXString **ppstrAppID );

	virtual HRESULT DownloadUpdatedXap( IPALOfflineApplicationStore *pOfflineStore, CXString *pstrXapLastModified, int lLastModifiedFallback, IPALMemory **ppNewXap, CXString **ppstrNewXapLastModified );

	virtual XUINT32 IsRunningInOfflineLauncher();

	virtual HRESULT CloseOfflineLauncher();

	virtual HRESULT GetRuntimeVersionCheckEnabled( XUINT32 *pbRuntimeVersionCheckEnabled );

	virtual HRESULT IsSeparateAppStoresSupported( XUINT32 * );
#pragma endregion

#pragma region IPALRegkeyServices
	virtual HRESULT GetDefaultVideoCaptureDeviceIdentifier( CXString **ppDefaultDevice );

	virtual HRESULT GetDefaultAudioCaptureDeviceIdentifier( CXString **ppDefaultDevice );

	virtual HRESULT SetDefaultVideoCaptureDeviceIdentifier( CXString *pDefaultDevice );

	virtual HRESULT SetDefaultAudioCaptureDeviceIdentifier( CXString *pDefaultDevice );

	virtual HRESULT GetAllowAllWebcamAccess( XUINT32 *pbAllowAllWebcamAccess );

	virtual HRESULT GetAllowWebcam( XUINT32 *pbAllowWebcam );

	virtual HRESULT GetAllowInstallOfElevatedTrustApps( XUINT32 *pbAllowInstall );

	virtual HRESULT GetAllowLaunchOfElevatedTrustApps( XUINT32 *pbAllowLaunch );

	virtual HRESULT GetAllowElevatedTrustAppsInBrowser( XUINT32 *pbAllowEPInBrowser );

	virtual HRESULT GetAllowUdpMulticastClients( XUINT32 *pbAllowMulticast );

	virtual HRESULT CheckForceGPUDecode( XUINT32 *pForceGPUVideoDecode );

	virtual HRESULT GetIsolatedStorageQuotaFromSettings( CXString *pstrDomainName, XUINT32 *pbSetQuotaToMax );

	virtual HRESULT GetClientInfoEnabled( XUINT32 *pfClientInfoEnabled );

	virtual HRESULT GetClientInfoAllowedDomains( CXString **ppAllowedDomains );

	virtual HRESULT GetIsolatedStorageInnerExceptionsAllowedDomains( CXString **ppAllowedDomains );

	virtual HRESULT CheckEnableGPUVideoDecode( PAL_GPU_DECODE_STATE *peGPUDecodeState );

	virtual HRESULT SetEnableGPUVideoDecode( PAL_GPU_DECODE_STATE eGPUDecodeState );

	virtual HRESULT GetEnableFramerateCounter( XUINT32 *pfEnableFramerateCounter );

	virtual HRESULT GetEnableOverdrawHeatMap( XUINT32 *pfEnableOverdrawHeatMap );

	virtual HRESULT ReadPrimitiveCompositorFlags( XUINT32 *pFlags );

	virtual HRESULT GetPasswordRevealDisabled( XUINT32 *pfPasswordRevealDisabled );
#pragma endregion

#pragma region IPALWebcamServices
	virtual HRESULT CreateCaptureGraph( IPALCaptureGraph **ppCaptureGraph );

	virtual HRESULT CreateVideoCaptureDeviceEnumerator( IPALVideoCaptureDeviceEnumerator ** );

	virtual HRESULT CreateAudioCaptureDeviceEnumerator( IPALAudioCaptureDeviceEnumerator ** );
#pragma endregion

#pragma region IPALSettingsServices
	virtual HRESULT GetUserRoot( IPALSettingsDictionaryNode **ppSettingsNode );

	virtual HRESULT GetMachineRoot( IPALSettingsDictionaryNode **ppSettingsNode );
#pragma endregion

#pragma region IPALFileSystemServices
	virtual HRESULT CreateFileFromUri( IPALUri *pUri, IPALFile **ppFile );
#pragma endregion

#pragma region IPALPrintingServices
	virtual HRESULT CreatePrintingData( IPALPrintingData **ppPrintingData );

	virtual HRESULT LaunchPrintDialog( const void *, XUINT32 *, IPALPrintingData * );

	virtual HRESULT StartDocument( IPALPrintingData *pPalPD );

	virtual HRESULT PrintPage( void *pvBitmap, IPALPrintingData *pPalPD );

	virtual HRESULT PrintPostscriptPage( char *, XUINT32, IPALPrintingData * );

	virtual HRESULT EndDocument( IPALPrintingData *pPalPD );

	virtual HRESULT CreateD2DPrintFactoryAndTarget( IPALAcceleratedGraphicsFactory **ppPrintFactory, IPALPrintTarget **ppPALPrintTarget );

	virtual HRESULT CreateD2DPrintingData( IPALD2DPrintingData **ppPrintingData );

#pragma endregion

#pragma region IPALImagingServices
	virtual HRESULT CreateImageFactory( IPALImageFactory **ppFactory );
#pragma endregion

	virtual void SetCanLoadAssembliesDomainNeutral( XUINT32 pValue );

	virtual void SetCustomControlHostExists( XUINT32 pValue );

	virtual HRESULT GetSystemSetting( _SystemSettingsType setting, CValue *pValue );

	virtual HRESULT GetSystemColor( XINT32 colorIndex, XINT32 * pSysColor );

	virtual HRESULT CreateGraphicsDeviceManager( IPALGraphicsDeviceManager **ppIGraphicsDeviceManager );

	virtual HRESULT CreateSurfaceUpdatePoolMap( IPALSurfaceUpdatePoolMap **ppSurfaceUpdatePoolMap );

	virtual HRESULT ReaderCreate( IPALReader **ppReader );

	virtual HRESULT BrowserHostCreate( IXcpHostSite *pSite, IXcpDispatcher *pDispatcher, IXcpBrowserHost **ppHost );

	virtual HRESULT RequestQuota( const void * hwndOwner, const XCHAR * pszSite, const XDOUBLE nUsedInMB, const XDOUBLE nRequestedInMB );

	virtual HRESULT OutputProtectionCreate( IPALOutputProtectionUtilities * pUtilities, IPALOutputProtection * * ppOutputProtection, enum OutputProtectionOptions::Value Options );

	virtual HRESULT FetchAbsoluteUri( XUINT32 cAbsoluteUri, XCHAR * pAbsoluteUri, XINT32 (__stdcall *fnAbortQueryCallback ) (XUINT32, void *), XUINT32 cbAbortContext, char *pvAbortContext, XCHAR * sUserAgent, IPALDownloadResponse **ppiDownloadResponse);

	virtual HRESULT CreateApplicationDataProvider( IPALApplicationDataProvider **ppAppDataProvider );

	virtual HRESULT CreateWorkItemFactory( IPALWorkItemFactory **ppFactory );

	virtual HRESULT CreateIPALStreamFromIPALMemory( IPALMemory *pPALMemory, IPALStream **ppPALStream );


private:
	long double m_eFrequency;
	_PerfMarkerType m_perfMarkerType;
	XINT32 m_perfCheckCompleted;
	HWND m_hPerfMonitor;
	HWND m_hBrowserControl;
	WinSystemSettings m_systemSettings;
	void *m_pHndState;
	XUINT32 m_bXmlLiteInitialized;
	CWinRegkeyServices m_regkeyServices;
	CWinWebcamServices m_webcamServices;
	
	HINSTANCE m_hmodSLBootstrap;
	XFixedSizeAllocator *m_pControlBlockAllocator;
	IXcpTraceMessageSink *m_pTraceSink;
	XUINT32 *m_pTraceFlags;
	IXcpRenderCounters *m_pRenderCounters;
	IValueStore *pHostProps;
	XUINT32 m_isDirectManipulationSupported;
	XUINT32 m_hasCheckedForDirectManipulationSupport;
	XINT64 m_allocatedMemory;
	XINT64 m_reportedMemory;
	volatile XUINT32 m_shouldReportMemoryToGC;
	_RTL_CRITICAL_SECTION m_reportedMemoryLock;
	XINT32 (__stdcall *m_pfnAddMemoryPressure)(XUINT64);
	XINT32 (__stdcall *m_pfnRemoveMemoryPressure)(XUINT64);

	virtual HRESULT GetOfflineApplicationStoreDirectory( XUINT32, struct IPALDirectory * * );

};


